package com.lyeducation.repository.system;

import com.lyeducation.entities.system.SysRoleEntity;
import com.lyeducation.entities.system.SysUserEntity;
import com.lyeducation.repository.base.BaseCodeRepository;
import com.lyeducation.util.controllerUtil.JsonResult;

import javax.servlet.http.HttpServletRequest;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface SysUserRepository extends BaseCodeRepository<SysUserEntity> {
  /**
   * 目前支持账户密码登录，邮件登录，手机登录
   *
   * @param getUserType
   * @param var
   * @return
   */
  SysUserEntity getUserByIdCodeEmailMobile(String getUserType, String var);
  //
  //  SysUserEntity getUserByEmail(String email);
  //
  //  SysUserEntity getUserByMobile(String mobile);

  /**
   * 用户信息保存或新增
   *
   * @author eiven
   * @param paramsMap
   * @return
   */
  JsonResult doSaveOrUpdate(Map paramsMap);

  /**
   * 注销登录
   *
   * @param request
   * @return boolean
   */
  boolean layout(HttpServletRequest request);
  //  /**
  //   * 登录
  //   *
  //   * @param paramsMap 查询条件
  //   * @return JsonResult
  //   */
  //  JsonResult doLogin(Map paramsMap);

  /**
   * 分配用户角色
   *
   * @param paramsMap 查询条件
   * @return JsonResult
   */
  JsonResult addUserRole(Map paramsMap);



  /** 更新登录成功基本参数 */
  void updUserParamByLoginSuccess(HttpServletRequest httpServletRequest)
      throws UnknownHostException;

  //  /** 更新登出基本参数 */
  //  void updUserParamByLoginOut(HttpServletRequest httpServletRequest) throws
  // UnknownHostException;

  SysUserEntity setLoginUserRoleMenu(SysUserEntity user);

  Set<SysRoleEntity> userGetMaxLevelSysRoleSet();

  List<SysRoleEntity> userGetRoleList(Map<String, Object> paramMap, List<String> roleNameList);

  //  void setChilendMenu(
  //          SysMenuEntity parentMenu, List<SysMenuEntity> sysMenuEntityList);
  //
  //  TreeSet<SysMenuEntity> upDownMenu(List<SysMenuEntity> sysMenuEntityList);
}
